home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / MOVEATTR.ASM < prev    next >
Assembly Source File  |  1988-12-18  |  2KB  |  97 lines

  1. Comment *
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │Title     : moveattr                                 │
  4. │purpose : moves a set of attibutes to a screen buffer.              │
  5. │                                         │
  6. │This routine does a block move  avoiding snow on the Ibm color card.         │
  7. │It does this by monitering the video status bit at port location 0x3da      │
  8. │by Jack A. Zucker (jaz) 75766,1336 on jan 25,1986                 │
  9. └────────────────────────────────────────────────────────────────────────────┘
  10.  *
  11.  
  12. title    buffer moveattr
  13. name    moveattr
  14.  
  15.     assume cs:_text
  16. _text    segment public byte 'code'
  17.     public _moveattr
  18.  
  19. public    _moveattr, next, status_low, status_high
  20.  
  21. _moveattr   proc near
  22.  
  23.     push bp
  24.     mov bp,sp
  25.     push si
  26.     push di
  27.     push es
  28.     push ds
  29.  
  30.     mov ax,[bp + 4]     ; get screen segment
  31.     mov ds,ax        ; in ds
  32.     mov si,[bp + 6]     ; get screen offset
  33.     inc si            ; point to attribute
  34.     mov bx,si        ; save screen offset in bx
  35.     mov ax,[bp + 8]     ; get number of rows
  36.     mov cl,[bp + 0Ah]    ; get number of columns
  37.     mov ch,[bp + 0Ch]    ; get attribute in ch
  38.     cmp [bp+4],0B000h    ; mono ?
  39.     jz mono
  40.  
  41. next:
  42.     mov dx,3dah        ; address of 6845 Status register
  43.     push ax
  44. status_low:
  45.     in al,dx        ; get vertical retrace status
  46.     ror al,1        ; faster than test
  47.     jc status_low        ; wait for partially done retrace
  48.     cli            ; don't allow any more interrupts
  49. status_high:
  50.     in al,dx        ; wait for beginning of new retrace
  51.     ror al,1
  52.     jnc status_high     ; retrace not started
  53.  
  54.     mov byte ptr [si],ch    ; paint attribute on screen
  55.     sti            ; interrupts allowed now
  56.     inc si
  57.     inc si
  58.     pop ax
  59.     dec cl
  60.     or cl,cl
  61.     jnz next
  62.     add bx,160
  63.     mov si,bx
  64.     mov cl,[bp + 0Ah]
  65.     dec ax
  66.     or ax,ax
  67.     jnz next
  68.     jmp exit
  69.  
  70. mono:
  71.     mov byte ptr [si],ch    ; paint attribute on screen
  72.     sti            ; interrupts allowed now
  73.     inc si
  74.     inc si
  75.     dec cl
  76.     or cl,cl
  77.     jnz mono
  78.     add bx,160
  79.     mov si,bx
  80.     mov cl,[bp + 0Ah]
  81.     dec ax
  82.     or ax,ax
  83.     jnz mono
  84.  
  85. exit:
  86.  
  87.     pop ds
  88.     pop es
  89.     pop di
  90.     pop si
  91.     mov sp,bp
  92.     pop  bp
  93.     ret
  94. _moveattr  endp
  95. _text    ends
  96.     end
  97.